package com.nut.api.biz;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Set;
import com.nut.common.Result;
import com.nut.entity.MemberInviteLog;
import com.nut.service.MemberInviteLogService;

@Slf4j
@RestController
@RequestMapping("/platform/memberInviteLog")
public class MemberInviteLogController {

    @Autowired
    private MemberInviteLogService memberInviteLogService;

    @GetMapping(value = "list")
    public Result<IPage<MemberInviteLog>> list(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return memberInviteLogService.listPage(pageNo, pageSize);
    }

    @GetMapping(value = "/{id}")
    public Result<MemberInviteLog> detail(@PathVariable Integer id) {
        return memberInviteLogService.getById(id);
    }

    @PostMapping
    public Result add(@RequestBody MemberInviteLog memberInviteLog) {
        return memberInviteLogService.add(memberInviteLog);
    }

    @PutMapping
    public Result update(@RequestBody MemberInviteLog memberInviteLog) {
        return memberInviteLogService.updateById(memberInviteLog);
    }

    @DeleteMapping
    public Result delete(@RequestBody Set<Integer> ids) {
        return memberInviteLogService.deleteByIds(ids);
    }

}